package com.day11.homework;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Proxy;
import java.util.Properties;

public class PropertyFactory {
    public PropertyFactory() {
    }

    public static PropertyAnnotation readProp(InputStream inputStream) {
        Properties properties = new Properties();
        try {
            properties.load(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
        return (PropertyAnnotation) Proxy.newProxyInstance(PropertyAnnotation.class.getClassLoader(), new Class[]{PropertyAnnotation.class}, new PropertyInvocationHandler(properties));
    }
}
